<template>
	<!-- 校友名片 -->
	<view class="ordercard-container">
		<!-- 名片显示 -->
		<view class="card">
			<image src="/static/img/alumni/card.png" mode="widthFix"></image>
			<view class="info">
				<view class="img">
					<image :src="detail.img" mode="widthFix"></image>
				</view>
				<view class="wrap">
					<view class="item">
						<view class="item-l">
							<view class="item-l-img">
								<image src="/static/img/card_icon/card_icon1.png" mode="widthFix"></image>
							</view>
							<view class="item-l-title">在校时间</view>
						</view>
						<view class="item-r">{{detail.school_time||'-'}}</view>
					</view>
					<view class="item">
						<view class="item-l">
							<view class="item-l-img">
								<image src="/static/img/card_icon/card_icon2.png" mode="widthFix"></image>
							</view>
							<view class="item-l-title">学历</view>
						</view>
						<view class="item-r">{{detail.degree||'-'}}</view>
					</view>
					<view class="item">
						<view class="item-l">
							<view class="item-l-img">
								<image src="/static/img/card_icon/card_icon3.png" mode="widthFix"></image>
							</view>
							<view class="item-l-title">学院</view>
						</view>
						<view class="item-r">{{detail.college||'-'}}</view>
					</view>
					<view class="item">
						<view class="item-l">
							<view class="item-l-img">
								<image src="/static/img/card_icon/card_icon4.png" mode="widthFix"></image>
							</view>
							<view class="item-l-title">专业</view>
						</view>
						<view class="item-r">{{detail.major||'-'}}</view>
					</view>
					<view class="item">
						<view class="item-l">
							<view class="item-l-img">
								<image src="/static/img/card_icon/card_icon5.png" mode="widthFix"></image>
							</view>
							<view class="item-l-title">手机号</view>
						</view>
						<view class="item-r">{{detail.mobile||'-'}}</view>
					</view>
					<view class="item">
						<view class="item-l">
							<view class="item-l-img">
								<image src="/static/img/card_icon/card_icon6.png" mode="widthFix"></image>
							</view>
							<view class="item-l-title">邮箱</view>
						</view>
						<view class="item-r">{{detail.email||'-'}}</view>
					</view>
					<view class="item">
						<view class="item-l">
							<view class="item-l-img">
								<image src="/static/img/card_icon/card_icon7.png" mode="widthFix"></image>
							</view>
							<view class="item-l-title">微信</view>
						</view>
						<view class="item-r">{{detail.wechat||'-'}}</view>
					</view>
					<view class="item">
						<view class="item-l">
							<view class="item-l-img">
								<image src="/static/img/card_icon/card_icon8.png" mode="widthFix"></image>
							</view>
							<view class="item-l-title">工作单位</view>
						</view>
						<view class="item-r">{{detail.workplace||'-'}}</view>
					</view>
					<view class="item">
						<view class="item-l">
							<view class="item-l-img">
								<image src="/static/img/card_icon/card_icon9.png" mode="widthFix"></image>
							</view>
							<view class="item-l-title">职务</view>
						</view>
						<view class="item-r">{{detail.post||'-'}}</view>
					</view>
				</view>
			</view>
		</view>

		<!-- 留言，接口没用到 -->
		<!-- <view class="message"></view> -->

		<!-- 底部按钮 -->
		<view class="bottom">
			<navigator class="mycard" url="/pages/My_card/My_card">我的名片</navigator>
			<view class="commute" @tap="commuteCard">交换名片</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// id
				id: '',
				// 详情
				detail: {},

			}
		},
		methods: {

			/**
			 * 申请交换名片
			 */
			commuteCard() {
				this.$request.post({
					url: '/api/users/changeBusinessCard',
					data: {
						user_id: this.id
					},
					success: res => {
						uni.showToast({
							title: res.result,
							icon: 'none'
						})
					}
				})
			},

			/**
			 * 获取校友详情
			 */
			getDetail() {
				this.$request.post({
					url: '/api/users/getCardInfo',
					data: {
						user_id: this.id
					},
					success: res => {
						if (res.code != 200) return uni.showToast({
							title: res.msg,
							icon: 'none'
						})
						this.detail = res.result.data
					}
				})
			}
		},
		onLoad(options) {
			if (!options.id) return uni.navigateBack()
			this.id = options.id
			this.getDetail()
		}
	}
</script>

<style lang="less" scoped>
	.ordercard-container {
		width: 100%;
		min-height: 100vh;
		background-color: #f6f6f6;
		overflow: hidden;
		padding-bottom: 258rpx;
		box-sizing: border-box;
		position: relative;

		.card {
			width: 618rpx;
			height: 890rpx;
			margin: 98rpx auto 0;
			position: relative;
			z-index: 5;

			>image {
				position: absolute;
				width: 100%;
			}

			.info {
				width: 100%;
				height: 100%;
				background-color: transparent;
				position: relative;
				padding-top: 182rpx;
				box-sizing: border-box;

				.img {
					width: 220rpx;
					height: 220rpx;
					border: 10rpx solid #fff;
					box-sizing: border-box;
					border-radius: 50%;
					overflow: hidden;
					position: absolute;
					left: 40rpx;
					top: -58rpx;
					z-index: 9;

					>image {
						width: 100%;
					}
				}

				.wrap {
					width: 100%;
					padding: 0 40rpx;
					box-sizing: border-box;

					.item {
						width: 100%;
						display: flex;
						align-items: center;
						margin-top: 36rpx;

						&-l {
							width: 206rpx;
							display: flex;
							align-items: center;

							&-img {
								width: 32rpx;
								height: 32rpx;
								margin-right: 12rpx;

								>image {
									width: 100%;
								}
							}

							&-title {
								font-size: 28rpx;
								font-family: Source Han Sans CN-Medium, Source Han Sans CN;
								font-weight: 500;
								color: #333333;
								line-height: 28rpx;
								letter-spacing: 1px;
							}
						}

						&-r {
							flex: 1;
							font-size: 28rpx;
							font-family: Source Han Sans CN-Regular, Source Han Sans CN;
							font-weight: 400;
							color: #333333;
							line-height: 28rpx;
							letter-spacing: 1px;
						}
					}
				}
			}
		}

		.message {
			width: 618rpx;
			height: 246rpx;
			background: #FFFFFF;
			box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.1);
			border-radius: 20rpx;
			opacity: 1;
			margin: 0 auto;
		}

		.bottom {
			width: 100%;
			height: 160rpx;
			background: #FFFFFF;
			box-shadow: 0rpx -4rpx 12rpx 0rpx rgba(140, 140, 140, 0.302);
			padding-top: 16rpx;
			box-sizing: border-box;
			display: flex;
			justify-content: space-evenly;
			position: fixed;
			bottom: 0;

			.mycard {
				width: 294rpx;
				height: 80rpx;
				border: 2rpx solid #275BA8;
				border-radius: 10rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				font-size: 32rpx;
				font-family: Source Han Sans CN-Medium, Source Han Sans CN;
				font-weight: 500;
				color: #275BA8;
				line-height: 46rpx;
				letter-spacing: 1px;
			}

			.commute {
				width: 294rpx;
				height: 80rpx;
				background-color: #275BA8;
				border-radius: 10rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				font-size: 32rpx;
				font-family: Source Han Sans CN-Medium, Source Han Sans CN;
				font-weight: 500;
				color: #FFFFFF;
				line-height: 46rpx;
				letter-spacing: 1px;
			}
		}
	}
</style>